package com.moioo.util;

/**
 * Insert the type's description here.
 * Creation date: (2003-3-8 18:43:28)
 * @author: 
 */
public class DbDataConvert {
	public DbDataConvert(){
	}
public static byte[] getBytesValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return theData.getBytes();
    return null;
}
public static byte getByteValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Byte.valueOf(theData).byteValue();
    return 0;
}
public static java.sql.Date getDateValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return java.sql.Date.valueOf(theData);
    return null;
}
public static double getDoubleValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Double.valueOf(theData).doubleValue();
    return 0;
}
public static float getFloatValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Float.valueOf(theData).floatValue();
    return 0;
}
public static int getIntValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Integer.valueOf(theData).intValue();
    return 0;
}
public static long getLongValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Long.valueOf(theData).longValue();
    return 0;
}
public static short getShortValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return Short.valueOf(theData).shortValue();
    return 0;
}
public static String getStringValue(byte[] theData) {
    if (theData != null)
        return theData.toString();
    return "";
}
public static String getStringValue(byte theData) {
    return String.valueOf((int) theData);
}
public static String getStringValue(double theData) {
	return String.valueOf(theData);
}
public static String getStringValue(float theData) {
	return String.valueOf(theData);
}
public static String getStringValue(int theData) {
	return String.valueOf(theData);
}
public static String getStringValue(long theData) {
	return String.valueOf(theData);
}
public static String getStringValue(String theData) {
    if (theData != null)
        return theData;
    return "";
}
public static String getStringValue(java.sql.Date theData) {
	return String.valueOf(theData);
}
public static String getStringValue(java.sql.Timestamp theData) {
	if (theData != null) return theData.toString().substring(0,10);
	else return "";
}
public static java.sql.Timestamp getTimestampValue(String theData) {
    if (theData != null)
        if (!"".equals(theData))
            return java.sql.Timestamp.valueOf(theData + " 00:00:00.000000000");
    return null;
}
}
